#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    int deleteAndEarn(vector<int> &nums)
    {
        vector<int> points(10001);
        int last = nums[0];
        for (auto v : nums)
        {
            points[v] += v;
        }
        vector<int> dp(10001);
        dp[0] = points[0];
        dp[1] = max(points[1], dp[0]);
        for (int i = 2; i < 10001; i++)
        {
            dp[i] = max(dp[i - 1], dp[i - 2] + points[i]);
        }
        return dp[10000];
    }
};
int main()
{
    cout << "Code740" << endl;
    Solution s;
    vector<int> nums{3,4,2};
    cout << s.deleteAndEarn(nums) << endl;
    return 0;
}